<?php require_once 'Lib/main.php';
$prodcutDAO = new Dao_ProductDAO();
$listNewProduct = $prodcutDAO->getNewestProduct();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
	<title>Chợ Tự Do - <?php echo Config_Messages::NEW_PRODUCT_CATEGORY; ?></title>
	<?php require_once 'headerResource.php';?>
</head>
<body>
	<div class="shell">
	
		<?php require_once 'topnavigation.php';?>
		<div class="cl"></div>
		
		<div id="wrapper-top"></div>
		<!-- Wrapper Middle -->
		<div id="wrapper-middle">
			<!-- Header -->
				<?php require_once 'header.php';?>
			<!-- END Header -->
			<!-- Navigation -->
			
			<?php require_once 'navigation.php';?>
			
			<!-- END Navigation -->
			<!-- Main -->
			<div id="main">
				<!-- Slider -->
					<?php require_once 'slider.php'; ?>
				<!-- END Slider -->
				<!-- Sidebar -->
				<div id="sidebar">
					
					<?php require_once 'leftCategory.php';?>
					
					<?php require_once 'sharing.php';?>
					
				</div>
				<!-- END Sidebar -->
				
				
				<!-- Content -->
				<div id="content">
					<!-- Products -->
					<div class="products">
					
						<div class="title">
							
							<h2><?php echo Config_Messages::NEW_PRODUCT_CATEGORY; ?></h2>
							<a class="title-link" title="More Products" href="newproduct.php">Xem thêm...</a>
							<img class="bullet" src="css/images/bullet.png" alt="small grey bullet" />
						
						</div>
						
						<div class="row">
							<?php
								$index = 0;
								/* @var $product Model_Product */
								foreach ($listNewProduct as $key => $product):
									if ($index !== 0 && ($index % 3) ==0) :
									?>
										</div><div class="row">
									<?php 
									endif; 
									++$index;
									?>
							
								<div class="product-holder">	
									<div class="product">
										<a title="More Details" href="detail.php?id=<?php echo $product->getId(); ?>">
											
										<img src="images/product/<?php echo $product->getImageFile(); ?>" alt="Yin Yang shaped bookshelf" /></a>
										
										<!-- <img class="top-label" src="css/images/top.png" alt="<?php echo $product->getName(); ?>" /> -->
										<img class="new-label" src="css/images/new.png" alt="<?php echo $product->getName(); ?>" />
										
										<div class="desc">
										
											<p><?php echo $product->getName(); ?></p>
											
											<p class="price">
												<span class="dollar"></span>
												<?php echo $product->getPrice(); ?> đ
											</p>
											
										</div>
										
										<div class="bottom"></div>
										
									</div>
									
									<div class="product-bottom"></div>
								</div>
								
							<?php 
							endforeach; 
							?>
						</div>
						<div class="cl"></div> 
						
					</div>
					<!-- END Products -->
					
				</div>
				<!-- END Content -->
				
				<div class="cl"></div>
				
			</div>
			
			<!-- END Main -->
		</div>
		<!-- END Wrapper Middle -->
		<div id="wrapper-bottom"></div>	
		<!-- Footer  -->
			<?php require_once 'footer.php';?>
		<!-- END Footer -->
	</div>
</body>
</html>